package cn.iocoder.yudao.module.product.dal.mysql.skustorerelation;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.product.dal.dataobject.skustorerelation.SkuStoreRelationDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.product.controller.admin.skustorerelation.vo.*;

/**
 * sku与门店关系 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface SkuStoreRelationMapper extends BaseMapperX<SkuStoreRelationDO> {

    default PageResult<SkuStoreRelationDO> selectPage(SkuStoreRelationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SkuStoreRelationDO>()
                .eqIfPresent(SkuStoreRelationDO::getSkuId, reqVO.getSkuId())
                .eqIfPresent(SkuStoreRelationDO::getPickUpStoreId, reqVO.getPickUpStoreId())
                .eqIfPresent(SkuStoreRelationDO::getType, reqVO.getType())
                .eqIfPresent(SkuStoreRelationDO::getFluctuationPrice, reqVO.getFluctuationPrice())
                .betweenIfPresent(SkuStoreRelationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SkuStoreRelationDO::getId));
    }
    default List<SkuStoreRelationDO> selectList(SkuStoreRelationRespVO reqVO) {
        LambdaQueryWrapperX<SkuStoreRelationDO> wrapperX = new LambdaQueryWrapperX<SkuStoreRelationDO>()
                .eqIfPresent(SkuStoreRelationDO::getSkuId, reqVO.getSkuId())
                .inIfPresent(SkuStoreRelationDO::getPickUpStoreId, reqVO.getDeptIds())
                .eqIfPresent(SkuStoreRelationDO::getType, reqVO.getType())
                .eqIfPresent(SkuStoreRelationDO::getFluctuationPrice, reqVO.getFluctuationPrice())
                .orderByDesc(SkuStoreRelationDO::getId);
        return selectList(wrapperX);
    }

}